<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>

/*------------------------------------------------------*/
/*                   修改控件的配置信息                                                                    */
/*------------------------------------------------------*/
var basePath = "<%=request.getScheme() %>" + "://" +"<%=request.getServerName()%>"+ ":" +"<%=request.getServerPort()%>" + "/synergy";

//64位控件的calssid
var classidx64="A64E3073-2016-4baf-A89D-FFE1FAA10EE0";
//32位控件的classid
var classid="A64E3073-2016-4baf-A89D-FFE1FAA10EC0";
//32位控件包的路径
var codebase=basePath+"/pages/jsp/commom/file/OfficeControl.cab#version=6,0,1,0";//"js/OfficeControl.cab#version=6,0,0,1";
//64位控件包的路径
var codebase64=basePath+"/pages/jsp/commom/file/OfficeControlX64.cab#version=6,0,1,0"//"js/OfficeControlx64.cab#version=5,0,3,1";
	
var objVersion="6,0,1,0";
var plusAllUrl32=basePath+"/pages/jsp/commom/file/ntkooledocall.cab";
var plusAllUrl64=basePath+"/pages/jsp/commom/file/ntkooledocall64.cab";
var plusAllUrl=plusAllUrl32;
//设置高度
var height= "<c:out value='${notkHeigth }' />px";//(window.screen.availHeight-40) + "px";
//设置宽度
var width="100%";
//买断授权密钥如果不是买断可以不用写
var MakerCaption=""; 
//买断授权密钥如果不是买断可以不用写
var MakerKey="";
//密钥
var ProductCaption="昆明轨道交通集团有限公司";
//密钥
var ProductKey="06889EF001665FA8A0BE33FF7539602085D20CA1";

var TANGER_OCX_OBJ; 
var HIDDEN_TANGER_OCX_OBJ;


$(function(){
	var browserMatch = uaMatch(ua);
	if (browserMatch.browser) {
		browser = browserMatch.browser;
		version = browserMatch.version;
	}
	if (browser=="IE"){
		if(window.navigator.platform=="Win32"){
			if($("#officeForm").size()==1){
				$("#officeForm").append('<!-- 用来产生编辑状态的ActiveX控件的JS脚本-->'
						+'<!-- 因为微软的ActiveX新机制，需要一个外部引入的js-->'
						+'<object id="TANGER_OCX" classid="clsid:'+classid+'"codebase="'+codebase+'" width="'+width
						+'" height="'+height+'"><param name="MakerCaption" value="'+MakerCaption+'">'
						+'<param name="MakerKey" value="'+MakerKey+'">'
						+'<param name="ProductCaption" value="'+ProductCaption+'">'
						+'<param name="ProductKey" value="'+ProductKey+'">'
						+'<param name="IsUseUTF8URL" value="-1">'
						+'<param name="IsUseUTF8Data" value="-1">'
						+'<param name="Caption" value="昆明轨道交通">'
						+'<SPAN STYLE="color:red">不能装载文档控件。请在检查浏览器的选项中检查浏览器的安全设置。</SPAN></object>');	
				inintTangerOcxObj();
			}
			
//			if($("#form2").size()==1){
//			$("#form2").append('<!-- 用来产生编辑状态的ActiveX控件的JS脚本-->'
//					+'<!-- 因为微软的ActiveX新机制，需要一个外部引入的js-->'
//					+'<object id="HIDDEN_TANGER_OCX" classid="clsid:'+classid+'"codebase="'+codebase+'" width="1px" height="1px">'
//					+'<param name="MakerCaption" value="'+MakerCaption+'">'
//					+'<param name="MakerKey" value="'+MakerKey+'">'
//					+'<param name="ProductCaption" value="'+ProductCaption+'">'
//					+'<param name="ProductKey" value="'+ProductKey+'">'
//					+'<param name="IsUseUTF8URL" value="-1">'
//					+'<param name="IsUseUTF8Data" value="-1">'
//					+'<param name="Caption" value="昆明轨道交通">'
//					+'<SPAN STYLE="color:red">不能装载文档控件。请在检查浏览器的选项中检查浏览器的安全设置。</SPAN></object>');	
//			inintHiddenTangerOcxObj();
//			}
		}
		if(window.navigator.platform=="Win64"){
			if($("#officeForm").size()==1){
			$("#officeForm").append('<!-- 用来产生编辑状态的ActiveX控件的JS脚本-->   '+
			'<!-- 因为微软的ActiveX新机制，需要一个外部引入的js-->   '+
			'<object id="TANGER_OCX" classid="clsid:'+classidx64+'"'+
			'codebase="'+codebase64+'" width="'+width+'" height="'+height+'">   '+		
			'<param name="MakerCaption" value="'+MakerCaption+'">   '+
			'<param name="MakerKey" value="'+MakerKey+'">   '+
			'<param name="ProductCaption" value="'+ProductCaption+'">   '+
			'<param name="ProductKey" value="'+ProductKey+'">   '+	
			'<param name="IsUseUTF8URL" value="-1">   '+
			'<param name="IsUseUTF8Data" value="-1">   '+
			'<param name="Caption" value="昆明轨道交通">   '+
			'<SPAN STYLE="color:red">不能装载文档控件。请在检查浏览器的选项中检查浏览器的安全设置。</SPAN>   '+
			'</object>');	
			plusAllUrl=plusAllUrl64;
			inintTangerOcxObj();
			}	
			
//			if($("#form2").size()==1){
//			$("#form2").append('<!-- 用来产生编辑状态的ActiveX控件的JS脚本-->   '+
//					'<!-- 因为微软的ActiveX新机制，需要一个外部引入的js-->   '+
//					'<object id="HIDDEN_TANGER_OCX" classid="clsid:'+classidx64+'"'+
//					'codebase="'+codebase64+'" width="1px" height="1px">   '+		
//					'<param name="MakerCaption" value="'+MakerCaption+'">   '+
//					'<param name="MakerKey" value="'+MakerKey+'">   '+
//					'<param name="ProductCaption" value="'+ProductCaption+'">   '+
//					'<param name="ProductKey" value="'+ProductKey+'">   '+	
//					'<param name="IsUseUTF8URL" value="-1">   '+
//					'<param name="IsUseUTF8Data" value="-1">   '+
//					'<param name="Caption" value="昆明轨道交通">   '+
//					'<SPAN STYLE="color:red">不能装载文档控件。请在检查浏览器的选项中检查浏览器的安全设置。</SPAN>   '+
//					'</object>');	
//			inintHiddenTangerOcxObj();
//			}	
		}	
	}
	else if (browser=="firefox"){ 	
		if($("#officeForm").size()==1){
		$("#officeForm").append('<object id="TANGER_OCX" type="application/ntko-plug"  codebase="'+codebase+'" width="'+width+'" height="'+height+'" ForOnSaveToURL="ntkosavetourl"  ForOndocumentopened="ntkoondocumentopened"'+		
			'ForOnpublishAshtmltourl="ntkopublishashtml"'+
			'ForOnpublishAspdftourl="ntkopublishaspdf"'+
			'ForOnSaveAsOtherFormatToUrl="ntkosaveasotherurl"'+	
			'_MakerCaption="'+MakerCaption+'"  '+
			'_MakerKey="'+MakerKey+'"  '+
			'_ProductCaption="'+ProductCaption+'"  '+
			'_ProductKey="'+ProductKey+'"   '+			
			'clsid="{'+classid+'}" >'+
			'<SPAN STYLE="color:red">尚未安装NTKO Web FireFox跨浏览器插件</SPAN>   '+
			'</object>   ');
		inintTangerOcxObj();
		}
		
//		if($("#form2").size()==1){
//		$("#form2").append('<object id="HIDDEN_TANGER_OCX" type="application/ntko-plug"  codebase="'+codebase+'" width="'+width+'" height="'+height+'" ForOnSaveToURL="ntkosavetourl"  ForOndocumentopened="ntkoondocumentopened"'+		
//				'ForOnpublishAshtmltourl="ntkopublishashtml"'+
//				'ForOnpublishAspdftourl="ntkopublishaspdf"'+
//				'ForOnSaveAsOtherFormatToUrl="ntkosaveasotherurl"'+	
//				'_MakerCaption="'+MakerCaption+'"  '+
//				'_MakerKey="'+MakerKey+'"  '+
//				'_ProductCaption="'+ProductCaption+'"  '+
//				'_ProductKey="'+ProductKey+'"   '+			
//				'clsid="{'+classid+'}" >'+
//				'<SPAN STYLE="color:red">尚未安装NTKO Web FireFox跨浏览器插件</SPAN>   '+
//				'</object>   ');
//		inintHiddenTangerOcxObj();
//		}
			
	}else if(browser=="chrome"){
		if($("#officeForm").size()==1){
		$("#officeForm").append('<object id="TANGER_OCX" clsid="{'+classid+'}"  ForOnSaveToURL="ntkosavetourl"  ForOndocumentopened="ntkoondocumentopened"'+
			'ForOnpublishAshtmltourl="ntkopublishashtml"'+
			'ForOnpublishAspdftourl="ntkopublishaspdf"'+
			'ForOnSaveAsOtherFormatToUrl="ntkosaveasotherurl"'+
			'_IsUseUTF8URL="-1"   '+
			'_IsUseUTF8Data="-1"   '+
			'_MakerCaption="'+MakerCaption+'"  '+
			'_MakerKey="'+MakerKey+'"  '+
			'_ProductCaption="'+ProductCaption+'"  '+
			'_ProductKey="'+ProductKey+'"   '+	
			'codebase="'+codebase+'" width="1px" height="1px" type="application/ntko-plug" '+
			'<SPAN STYLE="color:red">尚未安装NTKO Web Chrome跨浏览器插件</SPAN>   '+
			'</object>');
		inintTangerOcxObj();
		}
		
//		if($("#form2").size()==1){
//		$("#form2").append('<object id="HIDDEN_TANGER_OCX" clsid="{'+classid+'}"  ForOnSaveToURL="ntkosavetourl"  ForOndocumentopened="ntkoondocumentopened"'+
//				'ForOnpublishAshtmltourl="ntkopublishashtml"'+
//				'ForOnpublishAspdftourl="ntkopublishaspdf"'+
//				'ForOnSaveAsOtherFormatToUrl="ntkosaveasotherurl"'+
//				'_IsUseUTF8URL="-1"   '+
//				'_IsUseUTF8Data="-1"   '+
//				'_MakerCaption="'+MakerCaption+'"  '+
//				'_MakerKey="'+MakerKey+'"  '+
//				'_ProductCaption="'+ProductCaption+'"  '+
//				'_ProductKey="'+ProductKey+'"   '+	
//				'codebase="'+codebase+'" width="1px" height="1px" type="application/ntko-plug" '+
//				'<SPAN STYLE="color:red">尚未安装NTKO Web Chrome跨浏览器插件</SPAN>   '+
//				'</object>');
//		inintHiddenTangerOcxObj();
//		}
			
		}else if (Sys.opera){
			alert("sorry,ntko web印章暂时不支持opera!");
		}else if (Sys.safari){
			 alert("sorry,ntko web印章暂时不支持safari!");
		}
	
	//触发跨浏览插件的方法
	//ie关闭方法
	window.onunload =function(){
		window.opener.ntkoCloseEvent();	
	}
});


function  inintTangerOcxObj(){
	TANGER_OCX_OBJ = document.all("TANGER_OCX");
	TANGER_OCX_OBJ.AddDocTypePlugin(".tif","tif.NtkoDocument",objVersion,plusAllUrl,52,true);
	TANGER_OCX_OBJ.AddDocTypePlugin(".pdf","PDF.NtkoDocument",objVersion,plusAllUrl,51,true);
}
function  inintHiddenTangerOcxObj(){
	HIDDEN_TANGER_OCX_OBJ  = document.all("HIDDEN_TANGER_OCX");
	HIDDEN_TANGER_OCX_OBJ.AddDocTypePlugin(".tif","tif.NtkoDocument",objVersion,plusAllUrl,52,true);
	HIDDEN_TANGER_OCX_OBJ.AddDocTypePlugin(".pdf","PDF.NtkoDocument",objVersion,plusAllUrl,51,true);
}
